var t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), o = require("../../../@babel/runtime/helpers/asyncToGenerator"), e = require("../../../@babel/runtime/helpers/defineProperty"), s = getApp(), a = "", i = [], n = 1, r = 0, d = require("../../../wxParse/wxParse.js"), c = !0, u = "", h = "";

Component({
    properties: {
        prop_goods_info: {
            type: null
        },
        goodsId: {
            type: Number
        },
        goodsType: {
            type: String
        },
        mark: {
            type: String
        },
        hoet: {
            type: null
        },
        markId: {
            type: null
        },
        boxHeight: {
            type: Number
        },
        xqBoxShow: {
            type: null
        },
        toker: {
            type: Boolean
        },
        datop: {
            type: null
        }
    },
    data: {
        reserve_goods: !1,
        language: "",
        getprice: "",
        imagUrl: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/",
        current: 1,
        goodsInfo: {},
        goods_plugin: {},
        is_o2o: !0,
        o2oCount: 0,
        o2oName: "",
        o2oPhone: "",
        o2oLat: "",
        customer_open: !0,
        o2oLng: "",
        cartsNum: 0,
        carts: [],
        cartsTotal: 0,
        goodsCarts: {},
        popNum: 0,
        popCard: {},
        commentLimit: [],
        currentTabIndex: "0",
        first_content: "",
        second_content: "",
        third_content: [],
        is_first_content: !1,
        is_second_content: !1,
        is_third_content: !1,
        isGoodsLove: !1,
        goods_love_cash: 0,
        goods_love_deduction: 0,
        goods_love_name: "",
        specid: "",
        popTitle: "",
        popThumb: "",
        popStock: "",
        popPrice: "",
        goodsDescription: "",
        showCart: !1,
        btnData: {
            over_top: 500,
            icon_url: "https://www.yunzmall.com//min_img/icon-fontclass-zhiding.png"
        },
        posterShow: !1,
        show1: !1,
        posterImg: "",
        timestart: 0,
        timeend: 0,
        isCup: !0,
        isGoods: !1,
        showDis: !0,
        store_id: "",
        activityShow: !1,
        activityItem: {},
        firstActivityBtn: "",
        firstActivityCon: "",
        activitySwitch: !1,
        openVip: "2",
        salesCount: "",
        minicartStyle: "",
        leftPrice: "",
        OldGoodsNum: "",
        iPnoneBottomBol: !1,
        showSahre: !1,
        wechatcircle_open: 0,
        broadcast_data: [],
        isBuy: !1,
        isTime: !1,
        beginTime: 0,
        endTime: 0,
        countDownObj: {
            day: "00",
            hou: "00",
            min: "00",
            sec: "00"
        },
        toker: !1,
        customer_development: "",
        effective_time: [],
        effective_day: [],
        many_list: [],
        once_list: [],
        active: 0,
        wx_video_link: 0,
        showVideoLink: !1,
        article_url: null,
        limitedTimeCustomName: "限时购",
        isMultiSpecs: !1,
        specsVIPPrc: null,
        noneArr: [],
        operating_state: 1
    },
    lifetimes: {
        attached: function() {
            c = !0, this.getiPnoneBottom();
            var t = wx.getStorageSync("langIndex");
            this.setData({
                language: t.en
            }), this.getGoodsPage(this.data.prop_goods_info);
        },
        moved: function() {},
        detached: function() {},
        ready: function() {
            var t = wx.getStorageSync("yz_basic_info").lang.goods && wx.getStorageSync("yz_basic_info").lang.goods.price ? wx.getStorageSync("yz_basic_info").lang.goods.price : "现价", o = this;
            o.setData({
                getprice: t
            }), this.createSelectorQuery().select(".sift").boundingClientRect(function(t) {
                t && o.setData({
                    pjtop: t.top - 80
                });
            }).exec(), this.createSelectorQuery().select(".foShowBox").boundingClientRect(function(t) {
                t && o.setData({
                    xqtop: t.top - 100
                });
            }).exec();
        }
    },
    attached: function() {},
    ready: function() {},
    pageLifetimes: {
        show: function() {
            this.getCart();
        },
        hide: function() {},
        resize: function() {}
    },
    methods: {
        gotohuiyuan: function() {
            this.data.selfbuy_discount && this.data.selfbuy_discount.link_to_level_page && 1 == this.data.selfbuy_discount.link_to_level_page.show && wx.navigateTo({
                url: "/packageB/member/MemberGradeList/MemberGradeList"
            });
        },
        openShare: function() {
            this.setData({
                showSahre: !0
            });
        },
        closeSharePop: function() {
            this.setData({
                showSahre: !1
            });
        },
        shareGoods: function() {
            var t = this, o = s.getNetAddresss("plugin.wechatcircle_products.api.import.import"), e = {
                product_list: [ {
                    item_code: t.data.goodsInfo.id,
                    title: t.data.goodsInfo.title,
                    desc: t.data.goodsInfo.title,
                    category_list: [ "商品" ],
                    image_list: t.data.goodsInfo.thumb_url,
                    src_wxapp_path: "packageA/detail_v2/detail_v2?id=" + t.data.goodsInfo.id,
                    sku_list: [ {
                        sku_id: t.data.goodsInfo.id,
                        price: t.data.goodsInfo.price,
                        original_price: t.data.goodsInfo.market_price,
                        status: 1
                    } ]
                } ]
            };
            c && (c = !1, s._postNetWork({
                url: o,
                data: e,
                success: function(o) {
                    var e = o.data;
                    1 == e.result ? (setTimeout(function() {
                        c = !0;
                    }, 1e3), wx.openBusinessView ? wx.openBusinessView({
                        businessType: "friendGoodsRecommend",
                        extraData: {
                            product: {
                                item_code: t.data.goodsInfo.id,
                                title: t.data.goodsInfo.title,
                                image_list: t.data.goodsInfo.thumb_url
                            }
                        },
                        success: function(o) {
                            console.log("success", o), t.setData({
                                showSahre: !1
                            });
                        },
                        fail: function(o) {
                            console.log("fail", o), t.setData({
                                showSahre: !1
                            });
                        }
                    }) : wx.showToast({
                        title: "微信7.0.3及以上版本支持 请先更新微信版本",
                        icon: "none",
                        duration: 1500
                    })) : wx.showToast({
                        title: e.msg,
                        icon: "none",
                        duration: 1500
                    });
                },
                fail: function(t) {
                    setTimeout(function() {
                        c = !0;
                    }, 1e3), console.log(t);
                }
            }));
        },
        getiPnoneBottom: function() {
            try {
                wx.getStorageSync("iPhoneBottom") && this.setData({
                    iPnoneBottomBol: !0
                });
            } catch (t) {}
        },
        callPhone: function() {
            wx.makePhoneCall({
                phoneNumber: this.data.service_mobile
            });
        },
        closePop: function() {
            this.setData({
                show1: !1
            });
        },
        showPop: function() {
            this.data.customer_open && this.setData({
                show1: !0
            });
        },
        clearCart: function() {
            var t = this, o = [];
            this.data.carts.forEach(function(t) {
                o.push(t.id);
            });
            var e = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.destroy");
            e += "&store_id=" + this.data.store_id, e += "&ids=" + o, s._getNetWork({
                url: e,
                success: function(o) {
                    var e = o.data;
                    1 == e.result ? (t.getCart(), t.setData({
                        showCart: !1,
                        popNum: 0
                    })) : wx.showToast({
                        title: e.msg,
                        icon: "none",
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        gotoMemberGradeList: function(t) {
            "1" == t.currentTarget.dataset.o && wx.navigateTo({
                url: "/packageB/member/MemberGradeList/MemberGradeList"
            });
        },
        streetClose: function() {
            this.setData({
                streetShow: !1
            });
        },
        goKb: function() {
            console.log("打开全部口碑"), this.setData({
                streetShow: !0
            }), this.getCommentData();
        },
        closeCs: function() {
            this.setData({
                showCs: !1
            });
        },
        showCan: function() {
            console.log("开启参数弹窗"), this.setData({
                showCs: !0,
                is_second_content: !0,
                second_content: this.data.goodsInfo.has_many_params
            }), this.getCommentData();
        },
        getTap: function(t) {
            var o = this;
            console.log(t.currentTarget.id);
            var e = t.currentTarget.id;
            this.setData({
                current: e,
                getTapNoObsever: !0
            }), 1 == e ? wx.pageScrollTo({
                scrollTop: 0,
                duration: 300,
                success: function(t) {
                    setTimeout(function() {
                        o.setData({
                            getTapNoObsever: !1
                        });
                    }, 300);
                }
            }) : 2 == e ? wx.pageScrollTo({
                scrollTop: this.data.pjtop + 50,
                duration: 300,
                success: function(t) {
                    setTimeout(function() {
                        o.setData({
                            getTapNoObsever: !1
                        });
                    }, 300);
                }
            }) : 3 == e && (this.setData({
                xqBoxShow: !0
            }), wx.pageScrollTo({
                scrollTop: this.data.xqtop + 100,
                duration: 300,
                success: function(t) {
                    setTimeout(function() {
                        o.setData({
                            getTapNoObsever: !1
                        });
                    }, 300);
                }
            }));
        },
        _timeCompare: function(t) {
            var o = new Date(1e3 * parseInt(t));
            new Date() >= o ? (this.setData({
                isTime: !0
            }), this._countDown()) : (this.setData({
                isTime: !1,
                isBegTime: !0,
                begTimeStr: 1e3 * t
            }), this.beginDown());
        },
        _countDown: function() {
            var t = new Date().getTime(), o = this.data.endTime, e = null;
            if (o - t > 0) {
                var s = (o - t) / 1e3, a = parseInt(s / 86400), i = parseInt(s % 86400 / 3600), n = parseInt(s % 86400 % 3600 / 60), r = parseInt(s % 86400 % 3600 % 60);
                e = {
                    day: this._timeFormat(a),
                    hou: this._timeFormat(i),
                    min: this._timeFormat(n),
                    sec: this._timeFormat(r)
                };
            } else e = {
                day: "00",
                hou: "00",
                min: "00",
                sec: "00"
            };
            this.setData({
                countDownObj: e
            }), o - t < 0 ? this.setData({
                countDownObj: {
                    day: "00",
                    hou: "00",
                    min: "00",
                    sec: "00"
                }
            }) : setTimeout(this._countDown.bind(this), 1e3);
        },
        beginDown: function() {
            var t = new Date().getTime(), o = this.data.begTimeStr, e = null;
            if (o - t > 0) {
                var s = (o - t) / 1e3, a = parseInt(s / 86400), i = parseInt(s % 86400 / 3600), n = parseInt(s % 86400 % 3600 / 60), r = parseInt(s % 86400 % 3600 % 60);
                e = {
                    day: this._timeFormat(a),
                    hou: this._timeFormat(i),
                    min: this._timeFormat(n),
                    sec: this._timeFormat(r)
                };
            } else this.setData({
                isTime: !0,
                isBegTime: !1
            }), e = {
                day: "00",
                hou: "00",
                min: "00",
                sec: "00"
            };
            this.setData({
                beginDownObj: e
            }), o - t < 0 ? (this.setData({
                isTime: !0,
                isBegTime: !1
            }), this.setData({
                beginDownObj: {
                    day: "00",
                    hou: "00",
                    min: "00",
                    sec: "00"
                }
            })) : setTimeout(this.beginDown.bind(this), 1e3);
        },
        _timeFormat: function(t) {
            return t < 10 ? "0" + t : t;
        },
        getCart: function() {
            var t = this, o = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.index");
            o += "&store_id=" + this.data.goodsInfo.store_goods.store_id, s._getNetWork({
                url: o,
                success: function(o) {
                    var s = o.data;
                    1 == s.result && (t.setData({
                        carts: s.data,
                        goodsCarts: {},
                        cartsNum: 0,
                        cartsTotal: 0
                    }), t.data.carts.forEach(function(o) {
                        t.setData(e({}, "goodsCarts[" + o.goods_id + "]", o)), t.setData({
                            cartsNum: t.data.cartsNum + o.total,
                            cartsTotal: t.data.cartsTotal + o.total * o.goods.price
                        });
                    }), null == t.data.carts.find(function(o) {
                        return o.goods_id == t.data.goodsId;
                    }) && t.setData({
                        o2oCount: 0
                    }), t.data.carts.forEach(function(o) {
                        o.goods_id == t.data.goodsId && t.setData({
                            o2oCount: o.total
                        }), o.goods_id === t.data.goodsInfo.id && o.option_id === a && t.setData({
                            popNum: o.total,
                            popCard: o
                        });
                    }), t.setData({
                        goodsCartsTotal: t.calculateTotal1(t.data.carts),
                        cartsTotal: parseFloat(t.data.cartsTotal).toFixed(2)
                    }));
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        calculateTotal1: function(t) {
            var o = [], e = {}, s = {};
            for (var a in t) {
                var i = t[a].goods_id;
                e[i] ? e[i].total = e[i].total + t[a].total : (e[i] = {}, e[i].goods_id = t[a].goods_id, 
                e[i].total = t[a].total);
            }
            for (var n in e) o.push(e[n]);
            return o.forEach(function(t) {
                s[t.goods_id] = t;
            }), s;
        },
        handleClick: function(t) {
            var o = t.detail.index;
            this.data.currentTabIndex != o && (this.setData({
                currentTabIndex: o
            }), this.setDataByTabIndex());
        },
        setDataByTabIndex: function() {
            if ("0" != this.data.currentTabIndex || this.data.is_first_content) "1" != this.data.currentTabIndex || this.data.is_second_content ? "2" != this.data.currentTabIndex || this.data.is_third_content || (this.setData({
                is_third_content: !0
            }), this.getCommentData()) : this.setData({
                is_second_content: !0,
                second_content: this.data.goodsInfo.has_many_params
            }); else {
                this.setData({
                    is_first_content: !0,
                    first_content: this.data.goodsInfo.content
                });
                var t = this.data.first_content;
                try {
                    t.indexOf("&#") <= -1 && d.wxParse("article", "html", t, this);
                } catch (t) {}
            }
        },
        toTokerList: function(t) {
            this.setData({
                active: t.detail.index
            });
        },
        getCommentData: function() {
            var t = this, o = s.getNetAddresss("goods.comment.get-comment");
            o += "&goods_id=" + this.data.goodsId, o += "&page=1", s._getNetWork({
                showToastIn: !1,
                url: o,
                success: function(o) {
                    var e = o.data;
                    1 == e.result ? t.setData({
                        third_content: e.data.data
                    }) : t.setData({
                        is_third_content: !1
                    }), s._isTextEmpty(t.data.third_content) ? (console.log("空没评论"), t.setData({
                        thirKong: !1
                    })) : (console.log("不空"), t.setData({
                        thirKong: !0
                    }));
                },
                fail: function(o) {
                    t.setData({
                        is_third_content: !1
                    }), console.log(o);
                }
            });
        },
        toBuy: function() {
            wx.navigateTo({
                url: "/packageD/buy/myOrder_v2/myOrder_v2?tag=-2&store_id=" + this.data.goodsInfo.store_goods.store_id + "&goodsId=" + this.data.goodsInfo.id + "&optionsId=" + a + "&total=1"
            });
        },
        addCart: function(t) {
            var o = t.currentTarget.dataset.item, e = this;
            if (o.vip_level_status && 1 == o.vip_level_status.status) return wx.showToast({
                title: o.vip_level_status.tips,
                icon: "none",
                duration: 2e3
            }), !1;
            s._getNetWork({
                showToastIn: !1,
                url: s.getNetAddresss("member.member.isValidatePageGoods"),
                success: function(t) {
                    var a = t.data;
                    if (1 == a.result) {
                        if (e.data.goodsInfo.has_one_invite_page && 1 === e.data.goodsInfo.has_one_invite_page.status && 0 === a.data.is_invite) return void wx.navigateTo({
                            url: "/packageC/member/visit/Inviter/Inviter?fromGood=1"
                        });
                        var i = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.store");
                        i += "&goods_id=" + o.id, i += "&total=1", i += "&store_id=" + e.data.goodsInfo.store_goods.store_id, 
                        s._getNetWork({
                            url: i,
                            success: function(t) {
                                var o = t.data;
                                1 == o.result ? e.getCart() : wx.showToast({
                                    title: o.msg,
                                    icon: "none",
                                    duration: 1500
                                });
                            },
                            fail: function(t) {
                                console.log(t);
                            }
                        });
                    } else wx.showToast({
                        icon: "none",
                        title: a.msg,
                        duration: 1500
                    });
                }
            });
        },
        updateCartRequest: function(t, o) {
            var e = this, a = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.updateNum");
            a += "&id=" + t, a += "&num=" + o, a += "&store_id=" + this.data.goodsInfo.store_goods.store_id, 
            s._getNetWork({
                url: a,
                success: function(t) {
                    var s = t.data;
                    1 == s.result ? (o < 0 ? e.setData({
                        popNum: e.data.popNum - 1
                    }) : e.setData({
                        popNum: e.data.popNum + 1
                    }), e.getCart()) : wx.showToast({
                        title: s.msg,
                        icon: "none",
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        addGood: function(t) {
            if (this.data.goodsInfo.vip_level_status && 1 == this.data.goodsInfo.vip_level_status.status) return wx.showToast({
                title: this.data.goodsInfo.vip_level_status.tips,
                icon: "none",
                duration: 2e3
            }), !1;
            this.setData({
                show2: !0
            }), this.initPopView1();
        },
        initPopView1: function() {
            if (a = "", i = [], this.setData({
                specid: "",
                popNum: 0
            }), 1 === this.data.goodsInfo.has_option) {
                this.isShowMultiSpecsMemPrice(), this.setData({
                    popTitle: this.data.goodsInfo.title,
                    popThumb: this.data.goodsInfo.thumb,
                    popStock: this.data.goodsInfo.stock,
                    popCard: {}
                }), this.data.specid.length || this.setData({
                    popPrice: this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price
                }), this.setData({
                    goodsDescription: "请选择"
                });
                for (var t = 0; t < this.data.goodsInfo.has_many_specs.length; t++) this.setData({
                    goodsDescription: this.data.goodsDescription + " " + this.data.goodsInfo.has_many_specs[t].title
                });
                if (!this.data.optionsId) for (var o = 0; o < this.data.goodsInfo.has_many_specs.length; o++) this.selectSpecs(this.data.goodsInfo.has_many_specs[o].specitem[0], "first", o);
            } else this.setData({
                goodsDescription: ""
            }), n = this.data.goodsInfo.stock;
        },
        isShowMultiSpecsMemPrice: function() {
            var t, o, e = 0;
            this.data.goods_plugin && (e = (null === (t = this.data.goods_plugin) || void 0 === t || null === (o = t.member_price) || void 0 === o ? void 0 : o.is_open_micro) || 0), 
            1 == Number(e) && 1 == this.data.goodsInfo.has_option ? this.setData({
                isMultiSpecs: !0
            }) : this.setData({
                isMultiSpecs: !1
            });
        },
        close: function() {
            this.setData({
                show2: !1,
                specid: "",
                popNum: 0
            }), a = "", i = [];
        },
        selectSpecs: function(t, o, e) {
            var s = 0, i = 0, n = 0;
            if ("first" == o ? (s = t.id, i = 0, n = e) : (s = t.currentTarget.dataset.itemid, 
            i = t.currentTarget.dataset.index, n = t.currentTarget.dataset.indexl), this.manageSpecs(n, i), 
            this.setGoodsSpecs(n, i), this.setGoodsSpecsChangeInfo(s), this.getMaxCount(), console.log(this.data.specid), 
            this.data.reserve_goods) {
                for (var r = this.data.reserveJson, d = [], c = 0; c < r.length; c++) r[c].option_id == a && (d = r[c]);
                console.log(d), this.setData({
                    arrjson: d
                });
            }
        },
        manageSpecs: function(t, o) {
            var e = this.data.goodsInfo.has_many_specs[t].specitem[o], s = new Object();
            if (s.id = e.id, s.specid = e.specid, s.title = e.title, i.length > 0) {
                for (var a = 0; a < i.length; a++) i[a].specid == s.specid && i.splice(a, 1);
                i.push(s);
            } else i.push(s);
            if (i.length == this.data.goodsInfo.has_many_specs.length) {
                for (var n = [], r = 0; r < this.data.goodsInfo.has_many_specs.length; r++) for (var d = 0; d < i.length; d++) if (this.data.goodsInfo.has_many_specs[r].id == i[d].specid) {
                    n.push(i[d]);
                    break;
                }
                i = n;
            }
            this.setGoodsDescription();
        },
        setGoodsDescription: function() {
            var t = "";
            if (i.length == this.data.goodsInfo.has_many_specs.length) {
                t = "已选择 ";
                for (var o = 0; o < i.length; o++) t += i[o].title + " ";
                this.setData({
                    goodsDescription: t
                });
            } else {
                t = "请选择 ";
                for (var e = 0; e < this.data.goodsInfo.has_many_specs.length; e++) for (var s = 0; s < i.length; s++) if (this.data.goodsInfo.has_many_specs[e].id != i[s].specid) {
                    t += this.data.goodsInfo.has_many_specs[e].title + " ";
                    break;
                }
                this.setData({
                    goodsDescription: t
                });
            }
        },
        setGoodsSpecs: function(t, o) {
            for (var e = this.data.goodsInfo.has_many_specs[t].specitem[o], s = 0; s < this.data.goodsInfo.has_many_specs.length; s++) e.specid != this.data.goodsInfo.has_many_specs[s].id && this.setGoodsSpecsStatus(s, e.id);
        },
        setGoodsSpecsStatus: function(t, o) {
            for (var s = this.data.goodsInfo.has_many_specs[t].specitem, a = [], i = 0; i < this.data.goodsInfo.has_many_options.length; i++) for (var n = this.data.goodsInfo.has_many_options[i].specs.split("_"), r = 0; r < n.length; r++) if (n[r] == o) return void a.push(this.data.goodsInfo.has_many_options[i]);
            for (var d = 0; d < a.length; d++) for (var c = a[d].specs.split("_"), u = 0; u < c.length; u++) if (c[u] != o && 0 == a[d].stock) {
                for (var h = 0; h < s.length; h++) if (c[u] == s[h].id) return void this.setData(e({}, "data.goodsInfo.has_many_specs[" + t + "].specitem[" + h + "].c", !0));
            } else if (c[u] != o && a[d].stock > 0) for (var l = 0; l < s.length; l++) if (c[u] == s[l].id) return void this.setData(e({}, "data.goodsInfo.has_many_specs[" + t + "].specitem[" + l + "].c", !1));
        },
        setGoodsSpecsChangeInfo: function(t) {
            if (i.sort(function(t, o) {
                return t.id - o.id;
            }), i.length === this.data.goodsInfo.has_many_specs.length) {
                for (var o = "", e = 0; e < i.length; e++) o += i[e].id + "_";
                o = o.substring(0, o.length - 1), this.setData({
                    specid: o
                });
                for (var r = 0; r < this.data.goodsInfo.has_many_options.length; r++) if (o === this.setGoodsSpecsBySort(this.data.goodsInfo.has_many_options[r].specs)) {
                    this.setData({
                        popmPrice: this.data.goodsInfo.has_many_options[r].market_price,
                        popPrice: this.data.goodsInfo.has_many_options[r].product_price,
                        popThumb: s._isTextEmpty(this.data.goodsInfo.has_many_options[r].thumb) ? this.data.goodsInfo.thumb : this.data.goodsInfo.has_many_options[r].thumb,
                        popStock: this.data.goodsInfo.has_many_options[r].stock
                    }), a = this.data.goodsInfo.has_many_options[r].id, (n = this.data.goodsInfo.has_many_options[r].stock) > 0 && this.setData({
                        popNum: 0
                    }), this.data.isMultiSpecs && this.getMemberPrice(a);
                    break;
                }
                for (var d = 0; d < this.data.carts.length; d++) {
                    if (this.data.carts[d].goods_id === this.data.goodsInfo.id && this.data.carts[d].option_id === a) {
                        this.setData({
                            popNum: this.data.carts[d].total,
                            popCard: this.data.carts[d]
                        });
                        break;
                    }
                    this.setData({
                        popNum: 0,
                        popCard: {}
                    });
                }
            } else {
                for (var c = "", u = 0; u < i.length; u++) c += i[u].id + "_";
                this.setData({
                    specid: c
                });
            }
        },
        setGoodsSpecsBySort: function(t) {
            var o = t.split("_");
            o.sort(function(t, o) {
                return t - o;
            });
            for (var e = "", s = 0; s < o.length; s++) e += o[s] + "_";
            return e = e.substring(0, e.length - 1);
        },
        getMaxCount: function() {
            i.length == this.data.goodsInfo.has_many_specs.length && (0 == n && this.setData({
                popNum: 0
            }), this.data.popNum > n && this.setData({
                popNum: n
            }));
        },
        submitAction: function() {
            if (i.length < this.data.goodsInfo.has_many_specs.length) return this.setData({
                show2: !1
            }), void wx.showToast({
                title: this.data.goodsDescription,
                icon: "none",
                duration: 1500
            });
            this.addCartRequest(this.data.goodsInfo.id, a);
        },
        addCartRequest: function(t, o) {
            if (0 !== n) {
                var e = this, a = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.store");
                a += "&goods_id=" + t, a += "&total=1", a += "&option_id=" + o, a += "&store_id=" + this.data.goodsInfo.store_goods.store_id, 
                s._getNetWork({
                    url: a,
                    success: function(t) {
                        var o = t.data;
                        1 == o.result ? (e.setData({
                            popNum: e.data.popNum + 1
                        }), e.getCart(), wx.showToast({
                            title: o.msg,
                            icon: "none",
                            duration: 1500
                        })) : wx.showToast({
                            title: o.msg,
                            icon: "none",
                            duration: 1500
                        });
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            } else wx.showToast({
                title: "商品库存不足",
                icon: "none",
                duration: 1500
            });
        },
        gotoList: function() {
            wx.navigateTo({
                url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + this.data.goodsInfo.store_goods.store_id
            });
        },
        gophone: function(t) {
            var o = t.currentTarget.dataset.mobile;
            wx.makePhoneCall({
                phoneNumber: o
            });
        },
        goToAdress: function() {
            var t = this.data.o2oLat, o = this.data.o2oLng, e = this.data.o2oName, a = s.BMapTransqqMap(parseFloat(o), parseFloat(t));
            wx.openLocation({
                latitude: a.lat,
                longitude: a.lng,
                scale: 18,
                name: e
            });
        },
        goShowCart: function() {
            !this.data.showCart && this.data.cartsNum > 0 ? this.setData({
                showCart: !0
            }) : this.setData({
                showCart: !1
            }), this.getminicartStyle();
        },
        goodsOrder: function(e) {
            var a = this;
            if (1 != this.data.operating_state) {
                var i, n = this;
                s._getNetWork({
                    showToastIn: !1,
                    url: s.getNetAddresss("member.member.isValidatePageGoods"),
                    success: (i = o(t.default.mark(function o(e) {
                        var s, i, r;
                        return t.default.wrap(function(t) {
                            for (;;) switch (t.prev = t.next) {
                              case 0:
                                if (1 != (s = e.data).result) {
                                    t.next = 25;
                                    break;
                                }
                                if (!n.data.goodsInfo.has_one_invite_page || 1 !== n.data.goodsInfo.has_one_invite_page.status || 0 !== s.data.is_invite) {
                                    t.next = 7;
                                    break;
                                }
                                return wx.navigateTo({
                                    url: "/packageC/member/visit/Inviter/Inviter?fromGood=1"
                                }), t.abrupt("return");

                              case 7:
                                return t.next = 9, a.isHasDifferType(n.data.goodsCarts);

                              case 9:
                                if (t.sent) {
                                    t.next = 12;
                                    break;
                                }
                                return t.abrupt("return");

                              case 12:
                                if (console.log("执行"), i = n.data.goodsCarts.length, r = 0, n.data.carts.forEach(function(t) {
                                    r += t.total;
                                }), 0 != r) {
                                    t.next = 18;
                                    break;
                                }
                                return t.abrupt("return");

                              case 18:
                                if (0 != i.length && 0 != n.data.carts.length) {
                                    t.next = 22;
                                    break;
                                }
                                return t.abrupt("return");

                              case 22:
                                console.log('222222222',n.data.goodsType)
                                wx.navigateTo({
                                    url: "/packageD/buy/myOrder_v2/myOrder_v2?tag=store&store_id=" + n.data.goodsInfo.store_goods.store_id + "&goodsType=" + n.data.goodsType
                                });

                              case 23:
                                t.next = 26;
                                break;

                              case 25:
                                wx.showToast({
                                    icon: "none",
                                    title: s.msg,
                                    duration: 1500
                                });

                              case 26:
                              case "end":
                                return t.stop();
                            }
                        }, o);
                    })), function(t) {
                        return i.apply(this, arguments);
                    })
                });
            } else s.tips("门店休息中");
        },
        isHasDifferType: function(e) {
            return o(t.default.mark(function o() {
                var a, i, n, r;
                return t.default.wrap(function(t) {
                    for (;;) switch (t.prev = t.next) {
                      case 0:
                        if (a = 0, i = 0, n = "", e.forEach(function(t) {
                            t.live_install && 1 == t.live_install.open_state ? (a += 1, n = t.live_install.plugin_name) : i += 1;
                        }), 0 == a || 0 == i) {
                            t.next = 9;
                            break;
                        }
                        return t.next = 7, s.confirm("普通商品与".concat(n, "商品一同下单将无法享受").concat(n, "，是否继续下单？"));

                      case 7:
                        return r = t.sent, t.abrupt("return", r);

                      case 9:
                        return t.abrupt("return", !0);

                      case 10:
                      case "end":
                        return t.stop();
                    }
                }, o);
            }))();
        },
        goToGoodsO2O: function(t) {
            var o = t.currentTarget.dataset.item;
            1 !== this.data.store.operating_state && wx.redirectTo({
                url: "/packageA/detail_v2/detail_v2?id=" + o.goods_id + "&tag=o2o&store_id=" + this.data.goodsInfo.store_goods.store_id
            });
        },
        postShow: function() {
            this.setData({
                posterShow: !0,
                showSahre: !1
            });
        },
        posterClose: function() {
            this.setData({
                posterShow: !1
            });
        },
        timestart: function(t) {
            this.setData({
                timestart: t.timeStamp
            });
        },
        timeend: function(t) {
            this.setData({
                timeend: t.timeStamp
            });
        },
        saveImg: function() {
            wx.getSetting({
                success: function(t) {
                    t.authSetting["scope.writePhotosAlbum"] || wx.authorize({
                        scope: "scope.writePhotosAlbum",
                        success: function() {
                            console.log("授权成功");
                        }
                    });
                }
            });
            var t = this.data.posterImg.image_url;
            wx.downloadFile({
                url: t,
                success: function(t) {
                    console.log(t), wx.saveImageToPhotosAlbum({
                        filePath: t.tempFilePath,
                        success: function(t) {
                            wx.showToast({
                                title: "保存成功",
                                icon: "none",
                                duration: 2e3
                            });
                        },
                        fail: function(t) {
                            console.log(t), "saveImageToPhotosAlbum:fail auth deny" === t.errMsg && (console.log("当初用户拒绝，再次发起授权"), 
                            wx.openSetting({
                                success: function(t) {
                                    t.authSetting["scope.writePhotosAlbum"] ? wx.showToast({
                                        icon: "none",
                                        title: "获取权限成功,再次长按保存图片",
                                        duration: 1500
                                    }) : wx.showToast({
                                        icon: "none",
                                        title: "获取权限失败,保存图片需要用户授权",
                                        duration: 1500
                                    });
                                }
                            }));
                        },
                        complete: function(t) {
                            console.log(t);
                        }
                    });
                }
            });
        },
        gotoMember: function() {
            wx.reLaunch({
                url: "/packageG/member_v2/member_v2"
            });
        },
        gotoindex: function() {
            wx.reLaunch({
                url: "/packageG/index/index"
            });
        },
        pushGoodGoto: function(t) {
            var o = t.currentTarget.dataset.itemdata;
            wx.navigateTo({
                url: "/packageA/detail_v2/detail_v2?id=" + o.id
            });
        },
        gotoChat: function(t) {
            var o = t.currentTarget.dataset.cservice + "&goods_id=" + this.data.goodsId;
            wx.navigateTo({
                url: o,
                fail: function(t) {
                    s.tips("客服路由出错");
                }
            });
        },
        getGoodsPage: function(t) {
            var o = this;
            t.reserve_goods && this.setData({
                reserve_goods: t.reserve_goods
            }), t && t.get_goods ? (this.init(t.get_store_info), t.member_cart && this.getFirstCart(t.member_cart), 
            this.setData({
                service_QRcode: t.customer_service.service_QRcode,
                service_mobile: t.customer_service.service_mobile,
                cservice: t.customer_service.cservice,
                showMember: "1" == t.display_page
            }), t.is_favorite && this.setData({
                favorite: 1 == t.is_favorite.status
            }), this.getData(t.get_goods), this.data.customer_development && setTimeout(function() {
                o.setData({
                    toker: !0
                });
            }, 500), t.plugin && (this.setData({
                broadcast_data: t.plugin.broadcast_data,
                goods_plugin: t.plugin || {},
                customer_development: t.plugin.customer_development
            }), t.plugin.selfbuy_discount && this.setData({
                selfbuy_discount: t.plugin.selfbuy_discount
            }), s._isTextEmpty(t.plugin.lease_toy) || (this.setData({
                isRent: 1 == t.plugin.lease_toy.is_lease,
                isRentBuyShow: 0 != t.plugin.lease_toy.immed_goods_id
            }), s._isTextEmpty(t.plugin.lease_toy.is_rights) || this.setData({
                isRight: 1 == t.plugin.lease_toy.is_rights
            })), t.plugin.wechatcircle_open && 1 == t.plugin.wechatcircle_open && this.setData({
                wechatcircle_open: 1
            }), t.plugin && t.plugin.wx_video_link && this.setData({
                wx_video_link: t.plugin.wx_video_link
            }))) : this.setData({
                showDis: !1,
                show8: !0
            });
        },
        onFavorite: function(t) {
            var o = t.currentTarget.dataset.favorite;
            console.log(o), o ? this.removeFavorite() : this.addFavorite();
        },
        closeCalendar: function() {
            this.setData({
                showCalendar: !1
            });
        },
        formatDate: function(t) {
            return "".concat(t.getFullYear(), "/").concat(t.getMonth() + 1, "/").concat(t.getDate());
        },
        onConfirmCalendar: function(t) {
            this.setData({
                calendar_data: this.formatDate(t.detail)
            });
            for (var o = Date.parse(this.data.calendar_data) / 1e3, e = this.data.reserveDayArr, s = !1, a = [], i = 0; i < e.length; i++) o == e[i].time && (a.push(e[i]), 
            s = !0);
            if (s) {
                this.setData({
                    showCalendar: !1,
                    reserveJson: a,
                    show2: !0
                });
                for (var n = 0; n < this.data.goodsInfo.has_many_specs.length; n++) this.selectSpecs(this.data.goodsInfo.has_many_specs[n].specitem[0], "first", n);
            } else this.calendar_data = "", wx.showToast({
                title: "所选日期不可预约",
                icon: "none"
            });
        },
        confirmTap: function() {
            var t = this, o = this.data.reserveJson;
            this.data.arrjson = [];
            for (var e = 0; e < o.length; e++) o[e].option_id == a && this.setData({
                arrjson: o[e]
            });
            if (this.data.arrjson.id) if (a) {
                console.log(o);
                var i = s.getNetAddresss("plugin.store-reserve.frontend.goods.verify");
                s._getNetWork({
                    url: i,
                    data: {
                        option_id: a,
                        goods_id: t.data.goodsInfo.id
                    },
                    success: function(o) {
                        var e = o.data;
                        1 == e.result ? wx.navigateTo({
                            url: "/packageD/buy/myOrder_v2/myOrder_v2?tag=reserve&store_id=" + t.data.goodsInfo.store_goods.store_id + "&goodsId=" + t.data.goodsInfo.id + "&optionsId=" + a + "&total=1&date_id=" + t.data.arrjson.id
                        }) : wx.showModal({
                            icon: "none",
                            showCancel: !1,
                            content: e.msg,
                            duration: 1500
                        });
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            } else Toast("请选择规格"); else Toast("请选择日期");
        },
        tapReserve: function() {
            var t = this, o = s.getNetAddresss("plugin.store-reserve.frontend.date.getOptionDate");
            o += "&goods_id=" + this.data.goodsId, s._getNetWork({
                url: o,
                success: function(o) {
                    var e = o.data;
                    if (1 == e.result) {
                        console.log(e), t.setData({
                            showCalendar: !0,
                            reserveDayArr: e.data
                        });
                        var s = [], a = [], i = 0;
                        t.data.reserveDayArr.length > 0 && t.data.reserveDayArr.forEach(function(t, o, e) {
                            0 == s.length ? s.push(t) : s[i].time == t.time ? s[i].is_reserve ? (s[i] = t, s[i].is_reserve = !0) : 0 == t.is_reserve ? s[i] = t : (s[i] = t, 
                            s[i].is_reserve = !0) : (i += 1, s.push(t));
                        });
                        for (var n = 0; n < s.length; n++) s[n].is_reserve && a.push(String(s[n].date));
                        var r = t;
                        t.setData({
                            noneArr: a,
                            show2: !1,
                            formatter: function(t) {
                                return r.formatters(t);
                            }
                        });
                    } else "没有规格id" == e.msg ? wx.showToast({
                        title: "请选择规格",
                        icon: "none"
                    }) : wx.showToast({
                        title: e.msg,
                        icon: "none"
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        formatters: function(t) {
            var o = t.date.getMonth() + 1, e = t.date.getDate();
            if (o < 10 && (o = "0".concat(o)), e < 10 && (e = "0".concat(e)), t.type || (t.bottomInfo = "不可预约", 
            t.className = "calendar_data"), this.data.noneArr) for (var s = 0; s < this.data.noneArr.length; s++) "".concat(o, "-").concat(e) == this.data.noneArr[s] && (t.bottomInfo = "可预约", 
            t.className = "calendar_data");
            return "可预约" != t.bottomInfo && (t.bottomInfo = "不可预约", t.type = "disabled"), t;
        },
        removeFavorite: function() {
            var t = this, o = s.getNetAddresss("member.member-favorite.destroy");
            o += "&goods_id=" + this.data.goodsId, s._getNetWork({
                url: o,
                success: function(o) {
                    var e = o.data;
                    1 == e.result && (t.setData({
                        favorite: !1
                    }), wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    }));
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        addFavorite: function() {
            var t = this, o = s.getNetAddresss("member.member-favorite.store");
            o += "&goods_id=" + this.data.goodsId, s._getNetWork({
                url: o,
                success: function(o) {
                    var e = o.data;
                    1 == e.result && (t.setData({
                        favorite: !0
                    }), wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    }));
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        getData: function(t) {
            var o = this;
            try {
                0 == Number(t.market_price) ? t.notMarket_price = 0 : t.notMarket_price = 1;
            } catch (t) {
                console.log(t);
            }
            this.setData({
                goodsInfo: t,
                xqBoxShow: !!t.detail_show,
                commentLimit: t.get_comment.data ? t.get_comment.data.slice(0, 5) : []
            }), wx.setStorageSync("GoddsShareImg", t.thumb), t.has_one_goods_limit_buy && t.has_one_goods_limit_buy.status && t.has_one_goods_limit_buy.display_name && this.setData({
                limitedTimeCustomName: t.has_one_goods_limit_buy.display_name
            }), this.setData({
                salesCount: this.data.goodsInfo.show_sales + this.data.goodsInfo.virtual_sales
            }), this.data.goodsInfo.member_discount && (s._isTextEmpty(this.data.goodsInfo.member_discount.discount) ? this.setData({
                openVip: 1
            }) : this.setData({
                openVip: this.data.goodsInfo.member_discount.discount
            })), this.initPopView(), this.initPopView2(), this.setDataByTabIndex(), this.setIsAddCart(), 
            this.setIsLove(), this.setData({
                isGoods: !0
            }), this.setData({
                store_id: this.data.goodsInfo.store_goods.store_id,
                isMarginBottom: !s._isTextEmpty(t.show_push)
            }), s._isTextEmpty(t.has_one_goods_limit_buy) || (this.setData({
                isBuy: 1 == t.has_one_goods_limit_buy.status
            }), this.data.beginTime = t.has_one_goods_limit_buy.start_time, this.data.endTime = 1e3 * t.has_one_goods_limit_buy.end_time, 
            this._timeCompare(this.data.beginTime)), t.goods_sale && 0 != t.goods_sale.sale_count ? (this.setData({
                firstActivityBtn: t.goods_sale.first_strip_key.name
            }), "array" == t.goods_sale.first_strip_key.type ? t.goods_sale.first_strip_key.value.forEach(function(t, e) {
                0 == e ? o.setData({
                    firstActivityCon: t
                }) : o.setData({
                    firstActivityCon: o.data.firstActivityCon + "," + t
                });
            }) : this.setData({
                firstActivityCon: t.goods_sale.first_strip_key.value
            }), this.setData({
                activitySwitch: !0,
                activityItem: t.goods_sale
            }), this.showDefaultActivity(t.goods_sale)) : this.setData({
                activitySwitch: !1
            });
        },
        initPopView: function() {
            this.setData({
                popThumb: this.data.goodsInfo.thumb,
                popStock: this.data.goodsInfo.stock
            }), 1 == this.data.goodsInfo.has_option ? this.setData({
                popPrice: this.data.goodsInfo.min_price + "-" + this.data.goodsInfo.max_price
            }) : this.setData({
                popPrice: this.data.goodsInfo.price
            }), this.setData({
                goodsDescription: "选择"
            });
            for (var t = 0; t < this.data.goodsInfo.has_many_specs.length; t++) this.setData({
                goodsDescription: this.data.goodsDescription + " " + this.data.goodsInfo.has_many_specs[t].title
            });
        },
        initPopView2: function() {
            1 != this.data.goodsInfo.has_option && (this.setData({
                popThumb: this.data.goodsInfo.thumb,
                popStock: this.data.goodsInfo.stock,
                popPrice: this.data.goodsInfo.price,
                goodsDescription: ""
            }), n = this.data.goodsInfo.stock);
        },
        setIsAddCart: function() {
            (s._isTextEmpty(this.data.goodsInfo.buy_way) || "0" == this.data.goodsInfo.buy_way) && this.setData({
                isAddCart: !0
            }), 1 == this.data.goodsInfo.buy_way && this.setData({
                isAddCart: !1
            });
        },
        toContentInfo: function(t) {
            var o = t.currentTarget.dataset.jsondata;
            wx.navigateTo({
                url: "/packageD/member/CommentDetails/CommentDetails?order_id=" + o.order_id + "&goods_id=" + o.goods_id + "&uid=" + o.uid + "&comment_id=" + o.id
            });
        },
        setIsLove: function() {
            if (this.data.goods_plugin.goods_love) {
                this.setData({
                    isGoodsLove: !0
                });
                var t = this.data.goodsInfo.price - this.data.goods_plugin.goods_love.amountOfMoney;
                this.setData({
                    goods_love_cash: Number(t.toString().match(/^\d+(?:\.\d{0,2})?/))
                }), this.setData({
                    goods_love_deduction: this.data.goods_plugin.goods_love.amountOfCoin,
                    goods_love_name: this.data.goods_plugin.goods_love.name
                });
            } else this.setData({
                isGoodsLove: !1
            });
        },
        gotoCoupon: function() {
            wx.navigateTo({
                url: "/packageC/o2o/store_coupon/store_coupon?id=" + this.data.goodsInfo.store_goods.store_id
            });
        },
        activityShowFun: function() {
            this.setData({
                activityShow: !0
            });
        },
        activityShowBtn: function() {
            this.setData({
                activityShow: !1
            });
        },
        showDefaultActivity: function(t) {
            if ("coupon" == t.first_strip_key) this.setData({
                firstActivityBtn: "购买返券",
                firstActivityCon: "商品订单完成返优惠券"
            }); else if ("deduction_proportion" == t.first_strip_key || "award_proportion" == t.first_strip_key) this.setData({
                firstActivityBtn: t.love_name,
                firstActivityCon: "最高抵扣" + t.love_name + t.deduction_proportion + ",购买赠送" + t.award_proportion + t.love_name
            }); else if ("max_point_deduct" == t.first_strip_key || "point" == t.first_strip_key) this.setData({
                firstActivityBtn: t.point_name,
                firstActivityCon: "最高抵扣" + t.point_name + t.max_point_deduct + ",购买赠送" + t.point + t.point_name
            }); else if ("ed_full" == t.first_strip_key) this.setData({
                firstActivityBtn: "满减",
                firstActivityCon: "本商品满" + this.data.language.money + t.ed_full + "立减" + this.data.language.money + t.ed_reduction
            }); else if ("ed_money" == t.first_strip_key || "ed_num" == t.first_strip_key) this.setData({
                firstActivityBtn: "包邮"
            }), "ed_money" == t.first_strip_key && 0 == t.ed_num ? this.setData({
                firstActivityCon: "本商品满" + this.data.language.money + t.ed_money + this.data.language["元"] + "包邮"
            }) : "ed_num" == t.first_strip_key && 0 == t.ed_money ? this.setData({
                firstActivityCon: "本商品满" + t.ed_num + "件包邮"
            }) : this.setData({
                firstActivityCon: "本商品满" + this.data.language.money + t.ed_money + this.data.language["元"] + "包邮,满" + t.ed_num + "件包邮"
            }); else {
                if ("award_balance" != t.first_strip_key) return;
                this.setData({
                    firstActivityBtn: "余额",
                    firstActivityCon: "购买赠送余额" + t.award_balance + this.data.language["元"]
                });
            }
        },
        init: function(t) {
            this.setData({
                operating_state: t.operating_state,
                o2oName: t.store_name,
                o2oPhone: t.store_mobile,
                o2oLat: t.lat,
                o2oLng: t.lng
            });
        },
        getFirstCart: function(t) {
            var o = this;
            this.setData({
                carts: t,
                goodsCarts: [],
                cartsNum: 0,
                cartsTotal: 0
            }), console.log(this.data.carts), this.data.carts.forEach(function(t) {
                var s;
                o.setData((e(s = {}, "goodsCarts[" + t.goods_id + "]", t), e(s, "cartsNum", o.data.cartsNum + t.total), 
                e(s, "cartsTotal", o.data.cartsTotal + t.total * t.goods.price), s));
            }), null == this.data.carts.find(function(t) {
                return t.goods_id == o.data.goodsId;
            }) && this.setData({
                o2oCount: 0
            }), this.data.carts.forEach(function(t) {
                t.goods_id == o.data.goodsId && o.setData({
                    o2oCount: t.total
                }), t.goods_id === o.data.goodsInfo.id && t.option_id === a && o.setData({
                    popNum: t.total,
                    popCard: t
                });
            }), this.setData({
                goodsCartsTotal: this.calculateTotal1(this.data.carts),
                cartsTotal: parseFloat(this.data.cartsTotal).toFixed(2)
            });
        },
        footSet: function() {
            if (this.data.isGoods) {
                var t = s.getNetAddresss("member.member-history.store");
                t += "&goods_id=" + this.properties.goodsId + "&mark=" + this.properties.mark + "&mark_id=" + this.properties.markId, 
                s._getNetWork({
                    showToastIn: !1,
                    url: t,
                    success: function(t) {},
                    fail: function(t) {}
                });
            }
        },
        goTOHome: function() {
            wx.redirectTo({
                url: "/packageC/o2o/o2oHome/o2oHome"
            });
        },
        trggleCart: function() {
            (0 !== this.data.carts.length || this.data.showCart) && (this.setData({
                showCart: !this.data.showCart
            }), this.getminicartStyle());
        },
        getminicartStyle: function() {
            this.data.showCart ? this.setData({
                minicartStyle: "display: none;transform: translateY(-100%)",
                leftPrice: "transform: translateX(-60px);"
            }) : this.setData({
                minicartStyle: "display: block;transform: translateY(0)",
                leftPrice: ""
            });
        },
        updateCart1btn: function(t) {
            var o = t.currentTarget.dataset.id, e = t.currentTarget.dataset.num;
            this.updateCart1(o, e);
        },
        updateCart1: function(t, o) {
            if (o < 0) {
                var e = 0;
                if (this.data.carts.forEach(function(o) {
                    o.id == t && (e = o.total);
                }), e + o <= 0) return void (0 === r && (r = 1, this.delItemByCart1(t), setTimeout(function() {
                    r = 0;
                }, 500)));
                0 === r && (r = 1, this.updateCartRequest(t, o), setTimeout(function() {
                    r = 0;
                }, 500));
            } else {
                if (i.length == this.data.goodsInfo.has_many_specs.length && this.data.popNum == n) return void wx.showToast({
                    icon: "none",
                    title: "数量超出范围",
                    duration: 1500
                });
                0 === r && (r = 1, this.updateCartRequest(t, o), setTimeout(function() {
                    r = 0;
                }, 500));
            }
        },
        delItemByCart1: function(t) {
            var o = this, e = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.destroy");
            s._getNetWork({
                url: e,
                data: {
                    store_id: this.data.store_id,
                    ids: t
                },
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? (o.getCart(), o.setData({
                        popNum: o.data.popNum - 1,
                        showCart: !1,
                        minicartStyle: "display: block;transform: translateY(0)",
                        leftPrice: ""
                    })) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        updateCartbtn: function(t) {
            var o = t.currentTarget.dataset.id, e = t.currentTarget.dataset.num;
            this.updateCart(o, e);
        },
        updateCart: function(t, o) {
            if (o < 0) {
                var e = 0;
                if (this.data.carts.forEach(function(o) {
                    o.goods_id == t && (e = o.total);
                }), e + o <= 0) return void this.delItemByCart(t);
            }
            var a = this, i = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.updateNum");
            s._getNetWork({
                url: i,
                data: {
                    num: o,
                    store_id: this.data.store_id,
                    goods_id: t
                },
                success: function(t) {
                    var o = t.data;
                    1 == o.result || wx.showToast({
                        icon: "none",
                        title: o.msg,
                        duration: 1500
                    }), a.getCart();
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        delItemByCart: function(t) {
            var o = this, e = s.getNetAddresss("plugin.store-cashier.frontend.shoppingCart.member-cart.destroy");
            s._getNetWork({
                url: e,
                data: {
                    store_id: this.data.store_id,
                    goods_id: t
                },
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? o.getCart() : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        },
        clickCount: function(t) {
            var o = t.currentTarget.dataset.total;
            this.setData({
                OldGoodsNum: o
            });
        },
        changeCount: function(t) {
            var o = t.detail.value, e = t.currentTarget.dataset.id;
            if (o < 0) return wx.showToast({
                icon: "none",
                title: "商品数量不能为负数",
                duration: 1500
            }), this.setData({
                o2oCount: this.data.OldGoodsNum
            }), void this.getCart();
            if (o != this.data.OldGoodsNum) if (o < this.data.OldGoodsNum) {
                var s = this.data.OldGoodsNum - o;
                this.updateCart(e, -s);
            } else if (o > this.data.OldGoodsNum) {
                var a = o - this.data.OldGoodsNum;
                this.updateCart(e, a);
            }
        },
        getVideoLink: function() {
            wx.showLoading({
                title: "正在生成中..."
            });
            var t = this, o = s.getNetAddresss("plugin.wx-video-link.frontend.index.index");
            o += "&id=" + this.properties.goodsId, s._getNetWork({
                showToastIn: !1,
                url: o,
                success: function(o) {
                    var e = o.data;
                    1 == e.result ? "" == e.data.article_url || null == e.data.article_url || null == e.data.article_url ? setTimeout(function() {
                        t.getVideoLink();
                    }, 3e3) : (t.setData({
                        article_url: e.data.article_url,
                        showVideoLink: !0,
                        showSahre: !1
                    }), setTimeout(function() {
                        wx.hideLoading();
                    }, 800)) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {}
            });
        },
        onCopy: function() {
            wx.setClipboardData({
                data: this.data.article_url,
                success: function(t) {
                    wx.showToast({
                        title: "复制成功",
                        icon: "none",
                        duration: 1500
                    });
                },
                fail: function() {
                    wx.showToast({
                        title: "复制失败",
                        icon: "none",
                        duration: 1500
                    });
                }
            }), this.setData({
                showVideoLink: !1,
                article_url: ""
            });
        },
        getMemberPrice: function(t) {
            var o = this;
            if (t) {
                var e = 0;
                this.setData({
                    specsVIPPrc: e
                });
                var a = s.getNetAddresss("goods.other-info.option-vpi-price");
                a += "&option_id=" + t, s._getNetWork({
                    showToastIn: !1,
                    url: a,
                    success: function(t) {
                        var s = t.data;
                        e = 1 == s.result && s.data.vip_price || null, o.setData({
                            specsVIPPrc: e
                        });
                    },
                    fail: function(t) {
                        e = null, this.setData({
                            specsVIPPrc: e
                        });
                    }
                });
            }
        },
        toGroupCode: function() {
            "home" === this.data.goods_plugin.group_code.jump_mode ? wx.reLaunch({
                url: "/packageE/groupCode/groupCode"
            }) : this.data.goods_plugin.group_code.code_mini_url && wx.navigateTo({
                url: this.data.goods_plugin.group_code.code_mini_url
            });
        }
    },
    observers: {
        datop: function(t) {
            this.data.getTapNoObsever || (this.createSelectorQuery().select(".sift").boundingClientRect(function(t) {
                t && (u = t.top - 50);
            }).exec(), this.createSelectorQuery().select(".foShowBox").boundingClientRect(function(t) {
                t && (h = t.top - 150);
            }).exec(), h < 0 && u < 0 ? this.setData({
                current: 3
            }) : u <= 0 && h > 0 ? this.setData({
                current: 2
            }) : h > 0 && u > 0 && this.setData({
                current: 1
            }));
        }
    }
});